Skip to content

Conversation

jonatsm
Copy link
Member

@jonatsm jonatsm commented Oct 19, 2026

Description

Removes three duplicates in the frontend's sighting code:

  • GraphQL fields: SIGHTINGS_QUERY, SIGHTING_QUERY and CREATE_SIGHTING_MUTATION now share a SightingFields fragment instead of each listing the same eleven fields.
  • TypeScript type: removed CreatedSighting, which copied UfoSighting. The mutation's result now uses UfoSighting.
  • Retry code: useSighting and useSightingSearch both use a new createRetry helper in utils/create-retry.ts.

There are no behavior changes, and no tests were changed.

AI usage

Used Claude Code to check that the duplication and implement a shared interface.

Closes #66

The sightings query, the sighting query and the create mutations
now use a SightingFileds fragment, so the fields can't drift
apart between them.

Refs #66
useSighting and useSightingSearch had the same retry callback.
Both now use createREtry, so it is defined in one place.

Refs #66
@jonatsm jonatsm added frontend refactor Changes made to existing features labels Oct 19, 2026
@jonatsm jonatsm requested a review from a team as a code owner October 19, 2026 10:45
@jonatsm jonatsm linked an issue Oct 19, 2026 that may be closed by this pull request
2 tasks
Sign in to join this conversation on GitHub.
Labels
frontend refactor Changes made to existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove duplication in the sighting GraphQL code
1 participant